#include "cFont.h"

cFont::cFont() 
{
	D3DXFONT_DESC fontDesc;
	fontDesc.Height				= 18;
	fontDesc.Width				= 0;
	fontDesc.Weight				= 0;
	fontDesc.MipLevels			= 1;
	fontDesc.Italic				= false;
	fontDesc.CharSet			= DEFAULT_CHARSET;
	fontDesc.OutputPrecision	= OUT_DEFAULT_PRECIS;
	fontDesc.Quality			= DEFAULT_QUALITY;
	fontDesc.PitchAndFamily		= DEFAULT_PITCH | FF_DONTCARE;
	_tcscpy(fontDesc.FaceName, _T("Times New Roman"));

	HR(D3DXCreateFontIndirect(g_pD3DDevice, &fontDesc, &m_pD3DXFont));
}

cFont::~cFont()
{
	SAFE_RELEASE(m_pD3DXFont);
}

void cFont::drawText(char *text, RECT rect)
{
	m_pD3DXFont->DrawText( NULL, text, -1, &rect, DT_NOCLIP, 
							D3DCOLOR_ARGB(255,255,255,255));
}

void cFont::onLostDevice()
{
	m_pD3DXFont->OnLostDevice();
}

void cFont::onResetDevice()
{
	m_pD3DXFont->OnResetDevice();
}